package de.hhkk.view;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.Text;

public class Startwindow
{
    private static Text  text;
    private static Text  text_4;
    private static Text  text_5;
    private static Table table;

    /**
     * Launch the application.
     * @param args
     */
    public static void main(String[] args)
    {
        show();
    }

    public void setWurzelBerechnenListener(SelectionAdapter l)
    {

    }

    public static void show()
    {
        Display display = Display.getDefault();
        Shell shell = new Shell();
        shell.setSize(603, 539);
        shell.setText("SWT Application");
        shell.setLayout(new GridLayout(5, false));

        Label lblNewLabel = new Label(shell, SWT.NONE);
        lblNewLabel.setText("Name");

        text = new Text(shell, SWT.BORDER);

        Label lblNewLabel_4 = new Label(shell, SWT.NONE);
        lblNewLabel_4.setText("Dauer");

        text_4 = new Text(shell, SWT.BORDER);

        Button btnNewButton = new Button(shell, SWT.NONE);
        btnNewButton.setText("Suche");

        Label lblNewLabel_1 = new Label(shell, SWT.NONE);
        lblNewLabel_1.setText("Typ");

        Combo combo = new Combo(shell, SWT.NONE);

        Label lblNewLabel_5 = new Label(shell, SWT.NONE);
        lblNewLabel_5.setText("Teilnehmer");

        text_5 = new Text(shell, SWT.BORDER);
        new Label(shell, SWT.NONE);

        Button btnCheckButton = new Button(shell, SWT.CHECK);
        btnCheckButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
        btnCheckButton.addSelectionListener(new SelectionAdapter()
        {
            @Override
            public void widgetSelected(SelectionEvent e)
            {
            }
        });
        btnCheckButton.setText("Check Button");
        new Label(shell, SWT.NONE);
        new Label(shell, SWT.NONE);
        new Label(shell, SWT.NONE);

        table = new Table(shell, SWT.BORDER | SWT.FULL_SELECTION);
        table.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 5, 1));
        table.setHeaderVisible(true);
        table.setLinesVisible(true);

        TableColumn tblclmnNewColumn = new TableColumn(table, SWT.NONE);
        tblclmnNewColumn.setWidth(100);
        tblclmnNewColumn.setText("Name");

        TableColumn tblclmnNewColumn_1 = new TableColumn(table, SWT.NONE);
        tblclmnNewColumn_1.setWidth(100);
        tblclmnNewColumn_1.setText("Dauer");

        TableColumn tblclmnNewColumn_2 = new TableColumn(table, SWT.NONE);
        tblclmnNewColumn_2.setWidth(100);
        tblclmnNewColumn_2.setText("Typ");

        Button btnNewButton_1 = new Button(shell, SWT.NONE);
        btnNewButton_1.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
        btnNewButton_1.addSelectionListener(new SelectionAdapter()
        {
            @Override
            public void widgetSelected(SelectionEvent e)
            {
            }
        });
        btnNewButton_1.setText("Anlegen");
        new Label(shell, SWT.NONE);
        new Label(shell, SWT.NONE);
        new Label(shell, SWT.NONE);

        Menu menu = new Menu(shell, SWT.BAR);
        shell.setMenuBar(menu);

        MenuItem mntmNewSubmenu = new MenuItem(menu, SWT.CASCADE);
        mntmNewSubmenu.setText("Datei");

        Menu menu_1 = new Menu(mntmNewSubmenu);
        mntmNewSubmenu.setMenu(menu_1);

        MenuItem mntmNewItem = new MenuItem(menu_1, SWT.NONE);
        mntmNewItem.addSelectionListener(new SelectionAdapter()
        {
            @Override
            public void widgetSelected(SelectionEvent e)
            {
                System.exit(0);
            }
        });
        mntmNewItem.setText("Beenden");

        shell.open();
        shell.layout();
        while (!shell.isDisposed())
        {
            if (!display.readAndDispatch())
            {
                display.sleep();
            }
        }
    }
}
